﻿@model TYAJZWeb.Models.ProjectTagModel
@{
    ViewBag.Title = "打印标签";
}
@section BodyNav
{
    > @Html.ActionLink("工程列表", "List", "Project") > 打印标签
}
@section Js
{
    <script src="@Url.Content("~/Scripts/LodopFuncs.js")" type="text/javascript"></script>
    <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0"
        height="0">
        <param name="Border" value="0">
        <embed id="LODOP_EM" type="application/x-print-lodop" width="0" height="0"></embed>
    </object>
    <script type="text/javascript">
        var LODOP; //声明为全局变量 
        function prn1_preview() {
            LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
            LODOP.SET_PRINTER_INDEX(@Model.PrinterId);
           LODOP.SET_PRINT_MODE("POS_BASEON_PAPER",true);
           LODOP.SET_PRINT_MODE('AUTO_CLOSE_PREWINDOW',1);
            CreateOneFormPage();
            LODOP.PREVIEW();

            //LODOP.PRINT_DESIGN();
        };
        function CreateOneFormPage() {
            $('td.print').each(function()
            {
                LODOP.ADD_PRINT_TEXT($(this).attr('top'),$(this).attr('left'),$(this).attr('width'),$(this).attr('height'),$(this).html());
                LODOP.ADD_PRINT_TEXT(parseInt($(this).attr('top'))+140,$(this).attr('left'),$(this).attr('width'),$(this).attr('height'),$(this).html());
                LODOP.ADD_PRINT_TEXT(parseInt($(this).attr('top'))+280,$(this).attr('left'),$(this).attr('width'),$(this).attr('height'),$(this).html());
                LODOP.ADD_PRINT_TEXT(parseInt($(this).attr('top'))+420,$(this).attr('left'),$(this).attr('width'),$(this).attr('height'),$(this).html());
            });
        };
    </script>
}
<table class="window">
    <tr class="head">
        <th colspan="2">
            打印标签
        </th>
    </tr>
    <tr>
        <th width="75">
            @Html.LabelFor(t => t.ConstructionCompany)
        </th>
        <td class="print" top="27" left="65" width="130" height="45">
            @Model.ConstructionCompany
        </td>
    </tr>
    <tr>
        <th>
            @Html.LabelFor(t => t.Address)
        </th>
        <td class="print" top="60" left="65" width="130" height="45">
            @Model.Address
        </td>
    </tr>
    <tr>
        <th>
            @Html.LabelFor(t => t.DemolitionCompany)
        </th>
        <td class="print" top="100" left="65" width="130" height="45">
            @Model.DemolitionCompany
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="button" value="打印" class="btnBtn" onclick="prn1_preview()" />
            @Html.ActionLink("返回工程", "Detail", "Project", new { Id = Model.Id }, new { @class = "lnkBtn" })
            @Html.ActionLink("返回列表", "List", "Project", null, new { @class = "lnkBtn" })
        </td>
    </tr>
</table>
